
package privatemessanger;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JFrame;


/**
 * This class will make the pop up window frame of the "About".
 */
public class AboutWindow
{
    private MainFrame _mainFrame;

    /**
     * Setting up the popup window in the middle of the screen
     * @param mainFrame
     */
    public AboutWindow(MainFrame mainFrame)
    {
        //locate the new frame in the middle of the screen
        Toolkit tk = Toolkit.getDefaultToolkit();
        Dimension screenSize = tk.getScreenSize();
        int screenHeight = screenSize.height;
        int screenWidth = screenSize.width;

       JFrame frame=new JFrame("About");
       _mainFrame=mainFrame;

        //setting up the frame
        frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

        frame.setLocation(screenWidth / 4, screenHeight / 4);
        frame.setVisible(true);
        frame.setAlwaysOnTop(true);
        frame.setBackground(Color.white);
        frame.setSize(600, 350);

        frame.addWindowListener(new WindowAdapter()
        {
            @Override
            public void windowClosing(WindowEvent e){ _mainFrame.setVisible(true);}
        });

        AboutPanel _panels = new AboutPanel(frame,_mainFrame);
        frame.add(_panels);
        frame.setResizable(false);
   }
}
